<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>list</title>
[#include "/admin/include/head.htm"]
<script type="text/javascript">
    var grid;
    var currentRowId = -1;
    var viewFrameCutHeight = 65;
    $(function () {
        grid = $("#maingrid").ligerGrid({
            columns: [
				{name: 'id', hide: true, width:0, isAllowHide: false},
				{display: '操作', name: 'id', align: 'left', width: 40 ,render:function(row){
					return '<a style="color:blue" title="'+row["title"]+'"href="javascript:void(0)"  onclick="showViewFrame(\'' + row.id + '\'); return false;">查看</a>';
				}},
				{display: '标题', name: 'title', align: 'left', width: 250 },
	            {display: '类型', name: 'type', align: 'center', width: 100 , i18n:'ConsultType'},
	            {display: '会员名称', name: 'member.username', align: 'center', width: 60},
	            {display: '是否删除', name: 'deleteStatus', align: 'center', width: 60, dict:'common'},
	            {display: '是否回复', name: 'returnStatus', align: 'center', width: 60, dict:'common' },
	            {display: '创建时间', name: 'createDate', align: 'center', width: 150 },
	            {display: '更新时间', name: 'modifyDate', align: 'center', width: 150 },
	            
	            
            ],  
            pageSize:20, url: '${base}/admin/b2c/consult/queryData.jhtml',
			toolbar: {}, width: '100%', height:'100%', enabledSort: true
        });
        $("#pageloading").hide();
		LG.loadToolbar(grid);
		
		//绑定搜索按钮
		LG.search(grid);
		
		$("#viewFrame").css('height', $(".l-window-mask").height() - viewFrameCutHeight);
		
		$(window).bind('resize.ligeruiwin', function(){
			$("#viewFrame").css('height', $(".l-window-mask").height() - viewFrameCutHeight);
		});
		
		$(window).bind('scroll', function(){
			$("#viewFrame").css('height', $(".l-window-mask").height() - viewFrameCutHeight);
		});
		
    });
    
	function f_delete() {
		var selected = grid.getSelected();
      	if (selected) {
	      	jQuery.ligerDialog.confirm('确定删除吗?', function (confirm) {
				if (confirm){
					LG.ajax({
		              	url: base + '/admin/b2c/consult/delete.jhtml',
		              	loading: '正在删除中...',
		              	data: { ids: selected.id },
		              	success: function () {
		                  	LG.showSuccess('删除成功');
		                  	f_reload();
		              	},
		              	error: function (message) {
		                  	LG.showError(message);
		              	}
		          	});
				}
			});
      	} else {
          	LG.tip('请选择行!');
      	}
  	}
  	
  	/**
  	 *查看 
  	 */
  	function showViewFrame(id) {
		if(currentRowId != -1 && currentRowId == id){
			hide();
		}else{
			show();
			document.getElementById('viewFrame').src = 'view.jhtml?id='+id;
			currentRowId = id;
		}
	}
	
	function hide(){
		$("#maingrid").css('width','100%');
		$("#viewFrame").css('display','none');
		currentRowId = -1;
	}
	
	function show(){
		$("#maingrid").css('width','40%');
		$("#viewFrame").css('height', $(".l-window-mask").height() - viewFrameCutHeight);
		$("#viewFrame").css('display','block');
	}
	
	/**
	 *iframe子窗口调用 
	 */
	function f_reloadData(){
		f_reload('maingrid');
		hide();
	}
	
	/**
	 *iframe子窗口调用 
	 */
	function f_child_cancel(){
		hide();
	}
	
</script>
</head>
<body style="padding:10px; overflow:hidden;">
	<div id="functions" >
		<span>
			会员名:<input type="text" class="formText" name="search_EQ_member.username" style="width:100px"/>
		</span>
		<span>
			留言类型:[@u.select_map headerKey="" headerValue="全部"
					listKey="key" listValue="name"
					headerButtom="false" list=types
					name="search_EQ_type"/]
		</span>
		<span>
			阅读状态:[@u.select headerKey="" headerValue="全部"
					headerButtom="false" list={"true":"客户未查看","false":"客户已查看"}
					name="search_EQ_readStatus"/]
		</span>
		<span>
			回复状态:[@u.select headerKey="" headerValue="全部"
					headerButtom="false" list={"true":"已回复","false":"未回复"}
					name="search_EQ_returnStatus"/]
		</span>
		<span>
			删除状态:[@u.select headerKey="" headerValue="全部"
					headerButtom="false" list={"true":"已删除","false":"未删除"}
					name="search_EQ_deleteStatus"/]
		</span>
		<input type="button" id="search" class="button" value="搜索"/>
		<a href="#" id="search_btn_reset" face="Wingdings 3">解除搜索,显示全部数据</a>
	</div>
	<div>
		<div id="maingrid" style="margin:0; padding:0; width:50%; float: left"> </div>
		
		<div style="margin:0; padding:0; width:50%; height:600px; float: left">
			<iframe style="display: none" id="viewFrame" src="" width="100%" height="100%"></iframe>
		</div>
	</div>
</body>
</html>